package net.jumpengine.init;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.jumpengine.bean.TableBase;
import net.jumpengine.po.Column;

public class TableBaseInit {
	public static TableBase<?> init(int x,int y,int width,int height){
		TableBase<?> table=new TableBase<>(x, y, width, height);
		
		table.addColumn(new Column("序", true))
		.addColumns(
			new Column("名称","name",62),
			new Column("性别","sex",51),
			new Column("生日","birthday",130),
			new Column("电子邮箱","email",188),
			new Column("订阅","remark",1)
		);
		
		List<Map<String,?>> data=new ArrayList<Map<String,?>>(50);
		Map<String,Object> map=new HashMap<String,Object>(){
			private static final long serialVersionUID = 1L;
		{
			put("name","玛丽");
			put("sex","女");
			put("birthday","1990-02-05");
			put("email","xxxxx@163.com");
			put("remark",false);
		}};
		for(int i=0;i<10;i++) {
			data.add(map);
		}
		table.setDataList(data);
		return table;
	}
}
